<template>
  <div id="demand-management">
    <c-title text="需求管理"></c-title>
    <van-tabs v-model="state" title-active-color="#4978F8" color="#4978F8" @click="clickTab">
      <van-tab :title="item.name" :name="item.value" v-for="(item,index) in tabList" :key="index">
        <d-list :loading="loading" :finished="finished" @load="onLoad">
          <div class="demand-pane" @click="goDemandPage(citem.id)" v-for="(citem,cindex) in dataList" :key="cindex">
            <div class="demand-detail">
              <img :src="citem.has_one_category.thumb_url" alt="">
              <div class="right-row">
                <div class="top-rol">
                  <div class="title">{{citem.title}}</div>
                  <div class="content">{{citem.content}}</div>
                </div>
                <div class="bottom-row">
                  <span class="price-sty"><span class="price-icon">￥</span>{{citem.amount}}</span>
                  <span class="check-span" @click.stop="checkOrder(citem.order_id)">查看订单</span>
                </div>
              </div>
            </div>
            <div class="shelf-pane">
              <span class="shelf-name">上架</span>
              <van-switch v-model="citem.is_hide" active-color="#FF9C43" size="20" :active-value="0" :inactive-value="1" @click.stop="clickSwitch($event,citem)"/>
            </div>
          </div>
        </d-list>
      </van-tab>
    </van-tabs>
  </div>
</template>
<script>
import demand_management_controller from "./demand_management_controller";

export default demand_management_controller;
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
#demand-management {
  .demand-pane {
    background: #fff;
    padding: 0.6rem;
    margin-top: 0.425rem;

    .demand-detail {
      display: flex;

      img {
        width: 5.45rem;
        height: 5.45rem;
        background: #e8e8e8;
        border-radius: 0.2rem 0.2rem 0.2rem 0.2rem;
        margin: 0;
      }

      .right-row {
        // padding: 0.2rem 0;
        margin-left: 0.325rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 100%;

        .top-rol {
          text-align: left;

          .title {
            font-size: 0.9rem;
            font-weight: 400;
            color: #333;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            word-break: break-all;
            overflow: hidden;
          }

          .content {
            margin-top: 0.6rem;
            font-size: 0.8rem;
            font-weight: 400;
            color: #999;
            display: -webkit-box;
            -webkit-box-orient: vertical;
            -webkit-line-clamp: 1;
            word-break: break-all;
            overflow: hidden;
          }
        }

        .bottom-row {
          display: flex;
          justify-content: space-between;
          align-items: center;

          .price-sty {
            display: flex;
            font-size: 0.85rem;
            font-weight: 500;
            color: #ff9c43;

            .price-icon {
              font-size: 0.55rem;
              display: flex;
              align-items: center;
            }
          }

          .check-span {
            border-radius: 0.875rem 0.875rem 0.875rem 0.875rem;
            border: 0.025rem solid #ff9c43;
            padding: 0.175rem 0.5rem;
            color: #ff9c43;
          }
        }
      }
    }

    .shelf-pane {
      display: flex;
      justify-content: flex-start;
      align-items: center;
      font-size: 0.8rem;
      font-weight: 400;
      color: #999;
      margin-top: 0.825rem;

      .shelf-name {
        margin-right: 0.325rem;
      }
    }
  }
}
</style>
